package com.wenhuitec.android.tang.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Window;
import android.widget.EditText;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.wenhuitec.android.tang.R;
import com.wenhuitec.android.tang.config.SystemInit;

public class QieHuanSetDialog extends Dialog {
    private Window window = null;
    private Context mContext;
    private TextView yes; //确定按钮
    private TextView no; //取消按钮

    private EditText ziXiaoPosEd;
    private EditText xiaoMaiBuPosEd;

    public QieHuanSetDialog(@NonNull Context context) {
        super(context, R.style.CustomDialog);
        mContext = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_qiehuan_set);
        //点击dialog以外的空白处是否隐藏
        setCanceledOnTouchOutside(false);
        //初始化界面控件
        initView();
        //初始化界面数据
        initData();
        //初始化界面控件的事件
//        initEvent();
        //设置窗口显示
        windowDeploy();

    }

    private void initData() {

        yes.setOnClickListener(view -> {
            this.dismiss();
        });

        no.setOnClickListener(view -> {
            System.out.println("关闭点击");
            this.dismiss();
        });
    }

    private void initView() {
        yes = (TextView) findViewById(R.id.yes_printDialog);
        no = (TextView) findViewById(R.id.no_printDialog2);
        ziXiaoPosEd = findViewById(R.id.ziXiaoPosEd);
        xiaoMaiBuPosEd = findViewById(R.id.xiaoMaiBuPosEd);
    }

    private void windowDeploy() {
        window = getWindow();
        window.setGravity(Gravity.CENTER); //设置窗口显示位置
//        window.setWindowAnimations(R.style.dialogWindowAnim); //设置窗口弹出动画
    }

    public TextView getYes() {
        return yes;
    }

    public TextView getZiXiaoPosEd() {
        return ziXiaoPosEd;
    }

    public TextView getXiaoMaiBuPosEd() {
        return xiaoMaiBuPosEd;
    }
}
